This invention relates generally to digital graphics, and in particular to blending of graphics with a video overlay to achieve effects such as partial transparency and/or anti-aliasing.
The combination of graphics and video overlays is used in a wide variety of display systems. For example, while a television system receives and displays a broadcast program, the television system may also display graphics such as channel information and other menus or controls on the screen. The television system generates these graphics and then combines them with the broadcast program for display at the same time. Computing devices, such as computer systems and mobile phones, may also combine graphics and video overlays. For example, a computing device may display a streaming video on the device's display while also drawing graphics on the screen over the video, such as a cursor or menu.
One technique for combining graphics and video in a display system is called color keying (or chroma keying). In this technique, a particular color is defined as a color key. For each pixel in each frame, the display system will draw pixel from the graphics plane unless the color value of that pixel matches the color key, in which event the display system draws the corresponding pixel from the video overlay instead. Color keying is thus used to control which plane is visible, the graphics or the video overlay, on a per-pixel basis for each frame. In essence, the color key represents a fully transparent pixel in the graphics plane that allows the corresponding pixel in the video overlay plane to be seen.
In some applications, it is desirable to blend the graphics and video overlays so that the pixels drawn are a blend of the colors from each plane, rather than just being one or the other. Such an effect may be desirable, for example, to provide a partially transparent graphic (such as a menu) or to reduce aliasing of diagonal or round graphics against the video overlay. But traditional uses of color keys do not enable partially transparency of the graphics, since with color keying either the pixel from the graphics plane or the pixel from the video overlay plane is drawn. This binary nature of the pixels prevents partial transparency, and it may cause diagonal or round graphics to look jagged due to aliasing.
One technique for achieving partial transparency is known as alpha blending. In this technique, the pixel drawn on the display is a weighted average of the corresponding pixels from graphics and video overlays. For example, the following equation may be used to compute each channel of the pixel color, where the ratio α controls the blending between the graphics and video layers: final_pixel=graphics_pixel (1−α)+video_pixel (α). This computation is performed for each pixel of each rendered frame. Although alpha blending enables a high level of blending control, this technique is computationally expensive and not always possible.
What are needed are techniques that enable transparency and/or reduce aliasing in a display system for graphics and video overlay using color keys.